<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let nowMoney = 0;
    while (true) {
      let conduct = prompt(
        "请选择您的操作： 1.存钱 2.取钱 3.查看余额 4.退出 "
      );

      // 存钱
      if (conduct === "存钱") {
        let setMoney = parseFloat(prompt("请输入存入金额:(1 ~ +∞) "));
        nowMoney += setMoney;
        continue;


        // 取钱
      } else if (conduct === "取钱") {
        if (nowMoney <= 0) {
          alert("您的余额不足！");
          while (true) {
            conduct = prompt("您的余额不足，余额为：" + nowMoney + "元，请选择您的操作：1.存钱 2.返回 ");
            if (conduct === " 存钱") {
              let setMoney = parseFloat(prompt("请输入存入金额:(1 ~ +∞) "));
              nowMoney += setMoney;
              break;
            } else if (conduct === "返回") {
              break;
            } else {
              alert("请输入正确指令！");
            }
          }
          continue;
        }
        if (money > 0) {
          let getMoney = parseFloat(prompt("请输入取出金额:" + "（金额不超过当前余额" + nowMoney + "元）"));
          nowMoney = nowMoney - getMoney;
          continue;
        }



        // 查看余额
      } else if (conduct === "查看余额") {
        alert("当前余额为：" + nowMoney + "元。");
        while (true) {
          conduct = prompt(
            "您当前余额为" + nowMoney + "是否存钱：1.存钱，2.退出 "
          );
          if (conduct === "存钱") {
            let setMoney = parseFloat(prompt("请输入存入金额:(1 ~ +∞) "));
            nowMoney += setMoney;
            break;
          } else if ("退出") {
            break;
          } else {
            alert("请输入正确指令！");
          }
        }
        continue;


        // 退出
      } else if (conduct === "退出") {
        break;

      } else {
        alert("请输入正确输入您的操作： 1.存钱 2.取钱 3.查看余额 4.退出");
        continue;
      }


    }
  </script>
</body>

</html>